'use strict';

const util = require('util')


exports.FoundationError = function() {
    const tmp = Error.apply(this, arguments)
    tmp.name = this.name = 'FoundationError'
    Error.captureStackTrace(this, this.constructor)
}
util.inherits(exports.FoundationError, Error)




exports.Unauthorized = function(message = 'UNAUTHORIZED', code = 'UNAUTHORIZED') {
    Error.apply(this, arguments)
    this.name = 'FoundationUnauthorizedError'
    this.message = message
    Error.captureStackTrace(this, this.constructor)
}
util.inherits(exports.Unauthorized, Error)




exports.BadRequest = function(message = 'BadRequest') {
    Error.apply(this, arguments)
    this.name = 'FoundationBadRequestError'
    this.message = message
    Error.captureStackTrace(this, this.constructor)
}
util.inherits(exports.BadRequest, Error)




exports.Forbidden = function(message = 'Forbidden') {
    Error.apply(this, arguments)
    this.name = 'FoundationForbiddenError'
    this.message = message
    Error.captureStackTrace(this, this.constructor)
}
util.inherits(exports.Forbidden, Error)




exports.NotFound = function(message = 'NotFound') {
    Error.apply(this, arguments)
    this.name = 'FoundationNotFoundError'
    this.message = message
    Error.captureStackTrace(this, this.constructor)
}


util.inherits(exports.NotFound, Error)